x86/mm: Don't fail to nominate for paging on type flag, rather look at type count
authorAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)
committerAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)
Xen doesn't clean the type flag when dropping the type count for a page to
zero. So, looking at the type flag when nominating a page for paging it's
incorrect. Look at the type count instead.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c

index 31a10d8a25ab79ad860be1edcdf990f6b7fc8254..ded33853dc68c9126aa4611d69bea12af5ba1b5c 100644 (file)
@@ -759,7 +759,7 @@ int p2m_mem_paging_nominate(struct domain *d, unsigned long gfn)
          (1 | PGC_allocated) )
         goto out;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out;
 
     /* Fix p2m entry */
@@ -820,7 +820,7 @@ int p2m_mem_paging_evict(struct domain *d, unsigned long gfn)
          (2 | PGC_allocated) )
         goto out_put;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out_put;
 
     /* Decrement guest domain's ref count of the page */